<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false"%>
<%--
  Created by IntelliJ IDEA.
  User: xh
  Date: 2020/2/4
  Time: 15:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>技术栈 - Java程序员成长平台</title>
    <meta name="keywords" content="">
    <meta name="description" content>
    <link rel="stylesheet" href="vendor/layui-v2.4.5/layui/css/layui.css">
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/header.css">
    <link rel="stylesheet" href="css/footer.css">
    <link rel="stylesheet" href="css/index.css">
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>

<jsp:include page="head.jsp"></jsp:include>

<!-- 主体 -->
<div class="layui-main g-main">
    <!-- 轮播图 -->
    <div class="layui-carousel l-carousel" id="carousel">
        <div carousel-item>
            <div><img src="img/1.png" width="100%" height="280"></div>
            <div><img src="img/2.png" width="100%" height="280"></div>
            <div><img src="img/1.png" width="100%" height="280"></div>
            <div><img src="img/3.png" width="100%" height="280"></div>
            <div><img src="img/1.png" width="100%" height="280"></div>
        </div>
    </div>
    <!-- 4块图片显示区域 -->
    <div class="layui-row layui-col-space10 l-grids">
        <div class="layui-col-xs3">
            <img src="img/1.png" width="100%" height="120">
        </div>
        <div class="layui-col-xs3">
            <img src="img/2.png" width="100%" height="120">
        </div>
        <div class="layui-col-xs3">
            <img src="img/3.png" width="100%" height="120">
        </div>
        <div class="layui-col-xs3">
            <img src="img/1.png" width="100%" height="120">
        </div>
    </div>
    <!-- 主题列表-->
    <div class="layui-row layui-col-space30">
        <div class="layui-col-xs8">
            <!-- 博客 -->
            <blockquote class="layui-elem-quote my-layui-elem-quote">坚持写作的好处：<span>加深技术的理解、得到技术的认可、提高自己的思维能力和与其他人分享</span>。赶快参与吧！</blockquote>
            <div class="l-blog">
                <div class="layui-tab layui-tab-brief l-blog-tab" lay-filter="docDemoTabBrief">
                    <div class="tech-blog">
                        <a href="/blog/toBlog">博客</a>
                    </div>
                    <div class="more">
                        <a href="/blog/toBlog">更多</a>
                    </div>
                    <ul class="layui-tab-title">
                        <li class="layui-this">最新文章</li>
                        <li>热门文章</li>
                        <li>历史推荐</li>
                    </ul>
                    <div class="layui-tab-content">
                        <div class="tag">
                            <a href="">
                                <span class="layui-badge layui-bg-gray">Java核心技术</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">JSP/Servlet</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">数据库</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">框架开发</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">分布式架构</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">框架开发</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">分布式架构</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">框架开发</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">分布式架构</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">框架开发</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">分布式架构</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">框架开发</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">分布式架构</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">框架开发</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">分布式架构</span>
                            </a>
                        </div>
                        <div class="layui-tab-item layui-show">
                            <div class="layui-row">
                                <div class="layui-col-xs9 l-blog-list">
                                    <ul>
                                        <c:forEach items="${requestScope.blogs}" var="blog">
                                            <li>
                                            <a href="/blog/toBlog-detail?id=${blog.id}" class="layui-elip" title="${blog.title}">
                                                <c:if test="${blog.id==1}">
                                                    <span class="layui-badge layui-bg-cyan c-mr3"> 顶</span>
                                                </c:if>
                                               ${blog.title}</a>
                                            <span class="info" href="${APP_PATH}/user/toUser-home-for-other?id=${blog.userId}">${blog.blogInfo.user.username}</span>
                                        </li>
                                        </c:forEach>


                                    </ul>
                                </div>
                                <div class="layui-col-xs3 l-blog-recommend-list">
                                    <div class="layui-row layui-col-space5">
                                        <div class="layui-col-xs12">
                                            <a href="">
                                                <img src="img/recommend-blog.jpg" width="100%" height="100%">
                                                <span>5个步骤，教你瞬间明白线程和线程安全</span>
                                            </a>
                                        </div>
                                        <div class="layui-col-xs12">
                                            <a href="">
                                                <img src="img/recommend-blog.jpg" width="100%" height="100%">
                                                <span>5个步骤，教你瞬间明白线程和线程安全</span>
                                            </a>
                                        </div>
                                        <div class="layui-col-xs12">
                                            <a href="">
                                                <img src="img/recommend-blog.jpg" width="100%" height="100%">
                                                <span>5个步骤，教你瞬间明白线程和线程安全</span>
                                            </a>
                                        </div>
                                        <div class="layui-col-xs12">
                                            <a href="">
                                                <img src="img/recommend-blog.jpg" width="100%" height="100%">
                                                <span>5个步骤，教你瞬间明白线程和线程安全</span>
                                            </a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- 问答 -->
            <blockquote class="layui-elem-quote my-layui-elem-quote">致力于<span>Java程序员垂直问答社区</span>，专注分享知识、经验、观念。在这里，所有人都能找到答案、参与讨论。</blockquote>
            <div class="l-question">
                <div class="layui-tab layui-tab-brief l-question-tab" lay-filter="docDemoTabBrief">
                    <div class="question-answer">
                        <a href="/question/toQuestion">问答</a>
                    </div>
                    <div class="more">
                        <a href="/question/toQuestion">更多</a>
                    </div>
                    <ul class="layui-tab-title">
                        <li class="layui-this">问题</li>
                        <%--<li>已回答</li>--%>
                        <%--<li>已采纳</li>--%>
                        <%--<li>热门问答</li>--%>
                    </ul>
                    <div class="layui-tab-content">
                        <div class="tag">
                            <a href="">
                                <span class="layui-badge layui-bg-gray">Java核心技术</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">JSP/Servlet</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">数据库</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">框架开发</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">分布式架构</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">框架开发</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">分布式架构</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">框架开发</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">分布式架构</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">框架开发</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">分布式架构</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">框架开发</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">分布式架构</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">框架开发</span>
                            </a>
                            <a href="">
                                <span class="layui-badge layui-bg-gray">分布式架构</span>
                            </a>
                        </div>
                        <div class="layui-tab-item layui-show">
                            <div class="layui-row">
                                <div class="layui-col-xs12 l-question-list">
                                    <ul>
                                        <c:forEach items="${requestScope.questions}" var="question">
                                            <li>
                                            <a href="/question/toQuestion-detail?id=${question.id}" class="layui-elip" title="${question.title}">
                                                <c:if test="${question.id==1}"><span class="layui-badge layui-bg-cyan c-mr3">
                                                     顶</span></c:if>
                                                    ${question.title}</a>
                                            <span class="info" href="${APP_PATH}/user/toUser-home-for-other?id=${question.userId}">${question.questionInfo.user.username}</span>
                                            </li>
                                        </c:forEach>

                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="layui-tab-item">
                            <div class="layui-row">
                                <div class="layui-col-xs12 l-question-list">
                                    <ul>
                                        <li>
                                            <a href="" class="layui-elip" title="如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端数据库记录生成多条"><span class="layui-badge layui-bg-cyan c-mr3">顶</span>如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端数据库记录生成多条？</a>
                                            <span class="info">16回/1587阅</span>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-xs12 l-question-list">
                                    <ul>
                                        <li>
                                            <a href="" class="layui-elip" title="如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端数据库记录生成多条">如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端数据库记录生成多条？</a>
                                            <span class="info">16回/1587阅</span>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="layui-tab-item">
                            <div class="layui-row">
                                <div class="layui-col-xs12 l-question-list">
                                    <ul>
                                        <li>
                                            <a href="" class="layui-elip" title="如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端数据库记录生成多条"><span class="layui-badge layui-bg-cyan c-mr3">顶</span>如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端数据库记录生成多条？</a>
                                            <span class="info">16回/1587阅</span>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-xs12 l-question-list">
                                    <ul>
                                        <li>
                                            <a href="" class="layui-elip" title="如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端数据库记录生成多条">如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端数据库记录生成多条？</a>
                                            <span class="info">16回/1587阅</span>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <div class="layui-tab-item">
                            <div class="layui-row">
                                <div class="layui-col-xs12 l-question-list">
                                    <ul>
                                        <li>
                                            <a href="" class="layui-elip" title="如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端数据库记录生成多条"><span class="layui-badge layui-bg-cyan c-mr3">顶</span>如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端数据库记录生成多条？</a>
                                            <span class="info">16回/1587阅</span>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-xs12 l-question-list">
                                    <ul>
                                        <li>
                                            <a href="" class="layui-elip" title="如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端数据库记录生成多条">如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端数据库记录生成多条？</a>
                                            <span class="info">16回/1587阅</span>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                            <div class="layui-row">
                                <div class="layui-col-xs12 l-question-list">
                                    <ul>
                                        <li>
                                            <a href="" class="layui-elip" title="如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端数据库记录生成多条">如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端如何避免重复提交请求后端数据库记录生成多条？</a>
                                            <span class="info">16回/1587阅</span>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- 广告 -->
            <div>
                <img src="holder.js/750x80?text=底部广告图" width="750" height="80">
            </div>
        </div>
        <!-- 说说 -->
        <div class="layui-col-xs4 l-talk">

            <div class="l-talk-list">
                <form action="/talk/doAdd" method="post" id="form2">
                <div class="l-talk-send">
                    <input type="hidden" value="${sessionScope.user.id}" id="id2" name="userId">
                    <textarea name="main" id="main" placeholder="随便说说吧~" class="layui-textarea"></textarea>
                    <button type="button" class="layui-btn layui-btn-fluid" onclick="addTalk();">说说</button>
                </div>
            </form>
                <div class="layui-tab layui-tab-brief l-talk-tab" lay-filter="docDemoTabBrief">
                    <div class="more">
                        <a href="/talk/toIndex">更多</a>
                    </div>
                    <ul class="layui-tab-title">
                        <li class="layui-this">最新说说</li>
                        <li>热门说说</li>
                    </ul>
                    <div class="layui-tab-content">
                        <div class="layui-tab-item layui-show">
                            <c:forEach items="${requestScope.talks}" var="talk">
                                <div class="l-talk-list-item">
                                    <div class="photo">
                                        <a href="/user/toUser-home-for-other?id=${talk.userId}">
                                            <img src="img/photo.jpg" width="100%" height="100%" class="layui-circle">
                                        </a>
                                    </div>
                                    <div class="talk-content">
                                        <a href="/user/toUser-home-for-other?id=${talk.userId}" class="username">${talk.talkInfo.user.username}</a>：
                                        <span>${talk.main}</span>
                                        <div class="l-talk-footer">
                                            <span>
                                                    <a href="">1000评</a>
                                                </span>
                                            <span>
                                                    <a href="">
                                                        <i class="layui-icon layui-icon-picture"></i>
                                                    </a>
                                                </span>
                                            <span class="agree">
                                                    <i class="layui-icon layui-icon-praise" title="已赞">${talk.goodTotal}</i>
                                                </span>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-clear"></div>
                            </c:forEach>

                        </div>
                        <div class="layui-tab-item">
                            <div class="l-talk-list-item">
                                <div class="photo">
                                    <a href="">
                                        <img src="img/photo.jpg" width="100%" height="100%" class="layui-circle">
                                    </a>
                                </div>
                                <div class="talk-content">
                                    <a href="" class="username">张三</a>：
                                    <span>别闹，肯定是你的操作问题别闹，肯定是你的操作问题别闹，肯定是你的操作问题别闹，肯定是你的操作问题别闹，肯定是你的操作问题别闹，肯定是你的操作问题别闹，肯定是你的操作问题别闹，肯定是你的操作问题别闹，肯定是你的操作问题</span>
                                    <div class="l-talk-footer">
                                        <span>50分钟前</span>
                                        <span>
                                                    <a href="">1000评</a>
                                                </span>
                                        <span>
                                                    <a href="">
                                                        <i class="layui-icon layui-icon-picture"></i>
                                                    </a>
                                                </span>
                                        <span class="agree">
                                                    <a href="">
                                                        <i class="layui-icon layui-icon-praise">99</i>
                                                    </a>
                                                </span>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-clear"></div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>

<!-- 底部-->
<div class="g-footer layui-clear">
    <hr>
    <div>Copyright ©2018 技术栈(jishuzhan.club), All Rights Reserved.</div>
    <div>渝ICP备13001123号-2</div>
</div>

<script src="vendor/holder.min.js"></script>
<script src="vendor/layui-v2.4.5/layui/layui.js"></script>
<script src="js/common.js"></script>
<script src="js/index.js"></script>
<script src="jquery/jquery-2.1.1.min.js"></script>
<script>

    function addTalk() {

        $("#form2").submit();
    }

    function askQuestion() {
        location = 'ask-question.html';
    }

    function login() {
        var loginAccount=$("#account");
        var loginPassword=$("#password");


        if ( loginAccount === "" ) {
            layer.msg("账号不能为空！", {time:3000, icon:5, shift:6}, function(){
            });

        }

        if ( loginPassword==="" ) {

            layer.msg("密码不能为空！", {time:3000, icon:5, shift:6}, function(){
            });

        }

        $("#loginForm").submit();
    }

    function register(){


        // 获取用户数据的数据
        var loginAccount = $("#account2").val();
        var password=$("#password2").val();
        var username=$("#username").val();
        var tel=$("#tel").val();
        var password2=$("#password_comfirm").val();

        if(loginAccount == ''){
            layer.msg("账号不能为空！", {time: 3000, icon: 5, shift: 6}, null);
            return;
        }
        if(username == ''){
            layer.msg("用户名不能为空！", {time: 3000, icon: 5, shift: 6}, null);
            return;
        }
        if(password == ''){
            layer.msg("密码不能为空！", {time: 3000, icon: 5, shift: 6}, null);
            return;
        }

        if(tel == ''){
            layer.msg("用户名不能为空！", {time: 3000, icon: 5, shift: 6}, null);
            return;
        }

        if(password!=password2){
            layer.msg("两次密码不一致", {time: 3000, icon: 5, shift: 6}, null);
            return;
        }

        var loadingIndex = null;


        $.ajax({
            url : "/doRegister",
            method : 'POST',
            data : {
                account : loginAccount,
                username : username,
                password: password,
                tel:tel
            },
            beforeSend : function(){
                loadingIndex = layer.msg('正在插入，请稍后~~', {icon: 16});
            },
            success : function ( result ){
                if( result.success ){
                    layer.msg("注册成功！", {time: 3000, icon: 6, shift: 4}, function(){
                        // 跳转页面
                        window.location.href="/toLogin";
                    });
                } else {
                    layer.msg("注册失败了，请联系管理员！", {time: 3000, icon: 5, shift: 6}, null);
                }
            },
            complete : function(){
                layer.close(loadingIndex);
            }
        });
    }
</script>
</body>
</html>
